//
//  MYComplaintCell.m
//  JQLive
//
//  Created by Bruce on 2020/5/23.
//  Copyright © 2020 JQLive. All rights reserved.
//

#import "MYComplaintCell.h"

@interface MYComplaintCell ()
@property(nonatomic, strong) UIButton *selectBtn;
@end
@implementation MYComplaintCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    self.selectBtn.hidden = !selected;
    // Configure the view for the selected state
}
#pragma mark - Intial Methods

/**
 初始化数据
 */
- (void)initData
{
    self.selectionStyle = UITableViewCellSelectionStyleNone;
}

/**
 初始化试图
 */
- (void)initView
{
    [self addLeftLabel];
    [self addSelectBtn];
    [self addLineView];
}

- (void)addLeftLabel
{
    UILabel *label = [[UILabel alloc] init];
    label.numberOfLines = 1;
    label.text = @"";
    label.font = [UIFont boldSystemFontOfSize:16];
    label.textColor = MY_Text_Color_Theme1;
    label.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:label];
    self.leftLabel = label;
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(MY_Padding);
        make.centerY.mas_equalTo(0);
    }];
}

- (void)addSelectBtn
{
    UIImage *image = UIImageMake(@"ic_gou");
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setImage:image forState:UIControlStateNormal];

    [self.contentView addSubview:button];
    button.hidden = YES;
    self.selectBtn = button;
    [button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_offset(CGSizeMake(20, 20));
        make.right.mas_equalTo(-MY_Padding);
        make.centerY.mas_equalTo(0);

    }];
}
/**
 添加分割线视图
 */
- (void)addLineView
{
    UIView *view = [[UIView alloc] init];
    [self addSubview:view];
    view.backgroundColor = MYCell_Line_Color;
    [view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self);
        make.left.mas_equalTo(self).offset(MY_Padding);
        make.right.mas_equalTo(self).offset(-MY_Padding);
        make.height.mas_equalTo(MY_Line_Dfult_Height);
    }];
}
@end
